<template>
  <div class="LicenseInformationSJY">
    <div class="pubBig standard">
      <!-- <div class="h0 dd">
          <p class="lt"></p>
        </div> -->
      <div class="dDownMain" style="height: calc(100vh - 300px)">
        <div
          class="twoBox"
          :style="this.$route.query.Token ? 'top:50px;left:10px' : 'top: 100px'"
        >
          <el-row :gutter="18" style="margin-left: -9px; margin-right: 0">
            <el-col :span="8">
              <!-- 左侧卡片开始 -->
              <div class="box-card-is spll">
                <el-card class="box-card card_one">
                  <div slot="header" class="clearfix">
                    <span>平台值域</span>
                  </div>
                  <div>
                    <div>
                      <el-form label-width="100px" class="formStyle">
                        <el-form-item label="版本号" style="margin-bottom: 0">
                          <el-select
                            filterable
                            v-model.lazy="val_left_Tcode"
                            placeholder="系统版本号"
                            style="width: 100%"
                            @change="val_left_Tcode_change"
                            size="small"
                          >
                            <el-option
                              v-for="(item, index) in val_left_Tcodes"
                              :key="index"
                              :label="item"
                              :value="item"
                            >
                            </el-option>
                          </el-select>
                        </el-form-item>
                        <el-form-item label="值域代码/名称">
                          <el-input
                            v-model="value_Left"
                            class="inputS"
                            size="small"
                          ></el-input>
                          <el-button
                            size="small"
                            icon="el-icon-search"
                            @click="searchLeft"
                            style="margin-left: 15px"
                          ></el-button>
                        </el-form-item>
                      </el-form>
                    </div>
                    <div style="height: 500px; overflow-y: auto">
                      <el-tree
                        :data="datalist"
                        :props="defaultProps"
                        @node-click="handleNodeClick"
                        :filter-node-method="filterNode"
                        accordion
                        node-key="id"
                        v-loading="isLoading_a"
                        :highlight-current="true"
                        ref="tree"
                      >
                        <span
                          class="custom-tree-node"
                          slot-scope="{ node, data }"
                        >
                          <span style="width: 100px"
                            >{{ node.label
                            }}{{
                              data.Code ? "（" + data.Code + "）" : ""
                            }}{{
                              data.FileCode ? "（" + data.FileCode + "）" : ""
                            }}</span
                          >
                          <span style>
                            <el-button
                              v-if="false"
                              type="text"
                              size="mini"
                              @click="() => addjgTJ(node, data)"
                              >新增下一级</el-button
                            >
                            <el-button
                              v-if="false"
                              style="color: red"
                              type="text"
                              size="mini"
                              @click="() => remove(node, data)"
                              >删除</el-button
                            >
                          </span>
                        </span>
                      </el-tree>
                    </div>
                  </div>
                </el-card>
              </div>
              <!-- 左侧卡片结束 -->
            </el-col>

            <el-col :span="8">
              <!-- 右侧卡片开始 -->
              <div class="box-card-is">
                <el-card class="box-card card_one">
                  <div slot="header" class="clearfix">
                    <span>关联列表</span>
                  </div>
                  <!-- 右侧表格开始 -->
                  <div class="fjtable ypList table_right">
                    <p v-if="right_res.list.fieldName">
                      字段名称：<b>{{ right_res.list.fieldName }}</b>
                    </p>
                    <p v-if="right_res.list.fileName">
                      标准值域：<b style="margin-right: 10px">{{
                        right_res.list.fileName
                      }}</b>
                      版本：<b>{{ right_res.list.fileVersion }}</b>
                      <el-button
                        size="small"
                        type="warning"
                        plain
                        style="float: right"
                        @click="Automatic_comparison"
                        >自动对照</el-button
                      >
                      <el-button
                        size="small"
                        type="primary"
                        style="float: right"
                        @click="Automatic_ok"
                        >保 存</el-button
                      >
                    </p>
                    <el-button
                      v-if="!right_res.list.fileName"
                      size="small"
                      type="warning"
                      plain
                      style="float: right; margin-bottom: 5px"
                      disabled
                      >自动对照</el-button
                    >
                    <p>
                      <el-tag type="warning" style="font-size: 10px !important"
                        ><i class="el-icon-warning"></i>
                        提示：自动对照请选择左侧【平台值域】一级类目后，点击此按钮进行自动对照。</el-tag
                      >
                      <span style="display: block; padding: 3px 0"></span>
                      <el-tag type="warning" style="font-size: 10px !important"
                        ><i class="el-icon-info"></i> 规则：（当前对照规则为：字段值 == 标准值域值）</el-tag
                      >
                    </p>
                    <el-table
                      :data="right_res.list.relations"
                      height="480"
                      border
                      highlight-current-row
                      @current-change="handleCurrentChangeList"
                      v-loading="isLoading_c"
                      style="width: 100%; margin-top: 5px"
                      @row-click="R_row_click"
                      :row-class-name="tableRowClassName"
                      v-if="GL_table_show"
                    >
                      <el-table-column label="值" prop="oriValue">
                      </el-table-column>

                      <el-table-column label="对应值域值" prop="desValue">
                      </el-table-column>

                      <el-table-column
                        label="操作"
                        fixed="right"
                        align="center"
                        width="80px"
                      >
                        <template slot-scope="scope">
                          <el-button
                            @click="scope.row.desValue = ''"
                            size="mini"
                            >清除</el-button
                          >
                        </template>
                      </el-table-column>
                    </el-table>
                  </div>

                  <!-- 右侧表格结束 -->
                  <!-- 右侧页码开始 -->
                  <el-pagination
                    style="margin-top: 15px"
                    class="pageSum"
                    layout="prev, pager, next"
                    @current-change="handleCurrentChange"
                    :total="total + 0"
                    :current-page="getDataListObj.page"
                    :page-size="getDataListObj.limit"
                    v-if="false"
                  >
                  </el-pagination>
                  <!-- 右侧页码结束 -->
                </el-card>
              </div>
              <!-- 右侧卡片结束 -->
            </el-col>

            <el-col :span="8">
              <!-- 中间卡片开始 -->
              <div class="box-card-is">
                <el-card class="box-card card_one">
                  <div slot="header" class="clearfix">
                    <span>映射操作</span>
                  </div>
                  <div class="pucLabel">
                    <div class="form-group clearfix">
                      <el-form
                        label-position="right"
                        label-width="80px"
                        :model="itemObj"
                      >
                        <el-form-item
                          label-width="15px"
                          style="display: inline-block; width: 33%"
                        >
                          <el-select
                            filterable
                            v-model.lazy="itemObj.TName"
                            placeholder="系统名称"
                            size="small"
                          >
                            <el-option
                              v-for="item in optionsTName"
                              :key="item.ApplicationCode"
                              :label="item.ApplicationName"
                              :value="item.ApplicationCode"
                              @click.native="getDName(item)"
                            >
                            </el-option>
                          </el-select>
                        </el-form-item>
                        <el-form-item
                          label-width="15px"
                          style="display: inline-block; width: 33%"
                        >
                          <el-select
                            filterable
                            v-model.lazy="itemObj.DName"
                            placeholder="名称"
                            @change="getTable_auto"
                            size="small"
                          >
                            <el-option
                              v-for="item in optionsDName"
                              :key="item.Id"
                              :label="item.Name"
                              :value="item.Id"
                            >
                            </el-option>
                          </el-select>
                        </el-form-item>
                        <el-form-item
                          label-width="15px"
                          style="display: inline-block; width: 33%"
                        >
                          <el-select
                            filterable
                            v-model.lazy="itemObj.Table_name"
                            placeholder="表格"
                            @change="getTable_list_auto"
                            size="small"
                          >
                            <el-option
                              v-for="item in table_change"
                              :key="item"
                              :label="item"
                              :value="item"
                            >
                            </el-option>
                          </el-select>
                        </el-form-item>
                        <el-form-item
                          label-width="55px"
                          style="margin-top: -15px"
                        >
                        </el-form-item>
                        <div class="TwoCard" style="margin-top: -10px">
                          <el-table
                            v-loading="isLoading_b"
                            :data="getTable_autos"
                            style="width: 100%"
                            height="545px"
                            border
                          >
                            <el-table-column
                              type="index"
                              :index="
                                (index) => {
                                  return (
                                    getDataListObj.limit *
                                      (getDataListObj.page - 1) +
                                    index +
                                    1
                                  );
                                }
                              "
                              label="序号"
                              width="60"
                            >
                            </el-table-column>

                            <el-table-column prop="FieldName" label="字段名称">
                            </el-table-column>
                            <el-table-column
                              prop="Desc"
                              label="说明"
                              width="140px"
                            >
                            </el-table-column>
                            <el-table-column
                              label="操作"
                              width="70"
                              fixed="right"
                            >
                              <template slot-scope="scope">
                                <el-button
                                  style="float: right"
                                  @click="addData(scope.row)"
                                  size="mini"
                                  >绑定
                                </el-button>
                              </template>
                            </el-table-column>
                          </el-table>
                          <div class="block" v-if="false">
                            <el-pagination
                              layout="prev, pager, next"
                              :total="page_card_b.total"
                              :page-size="page_card_b.limit"
                              :current-page="page_card_b.page"
                              @current-change="table_change_auto"
                              style="text-align: center; margin-top: 20px"
                            >
                            </el-pagination>
                          </div>
                        </div>
                      </el-form>
                      <!-- 添加按钮 -->
                      <button
                        v-if="false"
                        style="float: right"
                        type="button"
                        class="btn btn-primary"
                        @click="addData()"
                      >
                        保存
                      </button>
                    </div>
                  </div>
                </el-card>
              </div>
              <!-- 中间卡片结束 -->
            </el-col>
          </el-row>
        </div>
      </div>
    </div>
  </div>
</template>
  <script>
import axios from "axios";
export default {
  data() {
    return {
      loading: false,
      名称列表: {},
      datalist: [],
      defaultProps: {
        children: "Child",
        label: "label",
      },
      itemList: [],
      itemObj: {
        Id: 0,
        RangeCode: "", //值域代码

        CodeValue: "", //代码值

        CodeName: "", //值域代码名称

        ValueMeaning: "", //值含义

        SpellCode: "", //拼音码

        Category: "", //类别

        Description: "", //说明

        TName: "", // 系统名称

        Version: "", // 系统版本号

        codoCode: "", // 系统值域名

        DName: "",
      },
      total: 1,
      getDataListObj: {
        page: 1,
        limit: 10,
      },
      msg: {},

      Permission: {
        PermissionId: 0,
        PermissionName: "",
        ParentId: 0,
        Url: "",
      },
      PermissionTK: {
        PermissionId: 0,
        PermissionName: "",
        ParentId: 1,
        Url: "",
      },
      isShow: "",
      selectZZJGObj: {},
      model_select_label: [], //权限类别
      model_pop_up: [], //弹出方式
      CDname: "",
      QQlabel: "",
      JGname: "",
      URlname: "",
      optionsTName: [], // 系统名称列表
      optionsVersion: [], // 系统版本号列表
      optionsDName: [],
      TNames: [],
      title: "关联列表", // 右侧卡片标题
      title_2: "",
      rowId: null,
      value_Left: "",
      value_Right: "",
      flase: false,
      val_left_Tcode: "",
      val_left_Tcodes: [],
      getTable_autos: [],
      data: [],
      getTable_auto_code: [],
      page_card_b: {
        page: 1,
        limit: 1000,
        total: 1,
      },
      table_change: [],
      isLoading_a: false,
      isLoading_b: false,
      isLoading_c: false,
      isTable_show: false,
      right_res: {
        list: {
          relations: [],
        },
      },
      R_row_click_info: {},
      GL_table_show: true,
      Automatic_tree: [],
    };
  },
  methods: {
    BanBenHao() {
      this.$get("PlatformRange/Version")
        .then((res) => {
          if (res.code == 0) {
            this.val_left_Tcodes = res.data;
            this.val_left_Tcode = this.val_left_Tcodes[0];
            this.queryG();
          }
        })
        .catch((err) => {});
    },
    getTable_auto() {
      this.isTable_show = false;
      // this.isLoading_b = true
      let params = {
        id: this.itemObj.DName,
      };
      this.$post("/ServiceManage/Offer/DbTables/" + params.id)
        .then((res) => {
          if (res.code == 0) {
            this.table_change = res.data;
            // this.isLoading_b = false
          } else if (res.code == -1) {
            this.$message({
              message: res.msg,
              type: "warning",
            });
          }
        })
        .catch((err) => {});
    },
    getTable_list_auto() {
      //获取映射操作表格数据
      this.isTable_show = true;
      this.isLoading_b = true;
      this.$post(
        "/ServiceManage/Offer/DbFields?id=" +
          this.itemObj.DName +
          "&tableName=" +
          this.itemObj.Table_name +
          "&page=" +
          this.page_card_b.page +
          "&limit=" +
          this.page_card_b.limit
      )
        .then((res) => {
          if (res.code == 0) {
            if (res.data.list == null) {
              this.getTable_autos = [];
              this.isLoading_a = false;
            } else {
              this.getTable_autos = res.data.list;
              // this.data = []
              // this.data.push({
              //   label: res.data.list[0].rangename,
              //   porp: "rangecode"
              // })
              this.page_card_b.total = res.data.TotalCount;
              this.isLoading_b = false;
            }
          }
        })
        .then(() => {
          this.isLoading_b = false;
        });
      // this.isLoading_b = false
    },
    table_change_auto(val) {
      this.page_card_b.page = val;
      this.getTable_list_auto();
    },
    search_btn() {
      //映射操作搜索按钮
      let params = {
        name: this.itemObj.DName,
        code: this.getTable_auto_code.Code,
        version: this.itemObj.Version,
        keyword: this.itemObj.codoCode,
      };
      this.$post(
        "/ServiceManage/Offer/DbFields?id=" +
          this.itemObj.DName +
          "&tableName=" +
          this.itemObj.Table_name +
          "&page=" +
          this.page_card_b.page +
          "&limit=" +
          this.page_card_b.limit
      )
        .then((res) => {
          if (res.code == 0) {
            this.getTable_autos = res.data;
          } else if (res.code == -1) {
            this.$message({
              message: res.msg,
              type: "warning",
            });
          }
        })
        .catch((err) => {});
    },
    handleNodeClick(obj, node, val) {
      if (this.right_res.list.relations.length < 1) {
        this.$notify.error({
          title: "警告",
          message: "请选择右侧映射字典绑定关联列表后操作！",
        });
        return;
      }
      if (node.level == 1) {
        //第一层
        this.right_res.list.fileName = obj.label;
        this.right_res.list.fileVersion = this.val_left_Tcode;
        this.Automatic_tree = obj.Child;
        // this.getTable_autos = []
      }
      if (node.level == 2) {
        //第2层
        if (this.R_row_click_info.index == undefined) {
          this.$notify.error({
            title: "警告",
            message: "请选中关联列表 => 行 后进行操作！",
          });
          return;
        }
        this.right_res.list.fileName = node.parent.data.label;
        this.right_res.list.relations[this.R_row_click_info.index].desValue =
          obj.Code;
        this.right_res.list.fileVersion = this.val_left_Tcode;
        // this.GL_table_show = false;
        // setTimeout((_) => {
        //   this.GL_table_show = true;
        // }, 100);
      }
    },
    handleCurrentChange(val) {
      this.getDataListObj.page = val;
      this.getDataList(this.itemObj.CodeName, this.itemObj.Category);
    },
    handleCurrentChangeList(val) {
      // this.itemObj.Id = val.Id;//,
      // this.itemObj.RangeCode = val.PMainCode;////值域代码
      // this.itemObj.CodeValue = val.CodeValue;////代码值
      // this.itemObj.CodeName = val.PMainName;////值域代码名称
      // this.itemObj.ValueMeaning = val.CodeValue;////值含义
      // this.itemObj.SpellCode = val.TMainCode;////拼音码
      // this.itemObj.Category = val.PMainCate;////类别
      // this.itemObj.Description = val.TMainName;////说明
      // this.itemObj.TName = val.TName; //// 系统名称
      // this.itemObj.Version = val.Version; ////系统版本号
      // this.itemObj.codoCode = val.TMainName;//// 系统值域名
    },
    tableRowClassName({ row, rowIndex }) {
      row.index = rowIndex;
    },
    R_row_click(row, column, event) {
      this.R_row_click_info = row;
    },
    deleteRowYP(index, rows) {
      if (rows[index].Id == 0) {
        rows.splice(index, 1);
      } else {
        this.deleteData(rows[index].id);
      }
    },

    //查询数据集
    queryG() {
      this.isLoading_a = true;
      var params = {};
      //GET /v1/DataElementValueRanges/tree
      this.$post(
        "PlatformRange/TreeList?version=" + this.val_left_Tcode,
        params
      )
        .then((res) => {
          if (res.code == 0) {
            this.loading = true;
            this.datalist = [];
            // this.datalist.push(res.data);
            for (var i = 0; i < res.data.length; i++) {
              res.data[i].label = "";
              res.data[i].label = res.data[i].FileName;
              if (res.data[i].Child != null && res.data[i].Child.length > 0) {
                for (var j = 0; j < res.data[i].Child.length; j++) {
                  res.data[i].Child[j].label = "";
                  res.data[i].Child[j].label = res.data[i].Child[j].Name;

                  if (
                    res.data[i].Child[j].Child != null &&
                    res.data[i].Child[j].Child.length > 0
                  ) {
                    for (
                      var n = 0;
                      n < res.data[i].Child[j].Child.length;
                      n++
                    ) {
                      res.data[i].Child[j].Child[n].label = "";
                      res.data[i].Child[j].Child[n].label =
                        res.data[i].Child[j].Child[n].Name;
                    }
                  }
                }
              }
            }
            this.datalist = res.data;
            this.isLoading_a = false;
          } else if (res.code == -1) {
            this.$message({
              message: res.msg,
              type: "warning",
            });
          }
        })
        .catch((err) => {});
    },
    //添加数据集
    addData(val) {
      var params = {
        Id: this.rowId == null ? null : this.rowId,
        PMainCate: this.itemObj.Category,
        PMainCode: this.itemObj.RangeCode,
        PMainName: this.itemObj.CodeName,
        TMainCode: val.RangeCode,
        TMainName: val.RangeName,
        TMainValue: val.RangeCode,
        TCode: this.itemObj.TName,
        TName: this.ApplicationName,
        //  val.MedicalInstitutionCode,
        HospitalId: this.名称列表.HospitalId,
        // Version: this.itemObj.Version
      };
      //POST /v1/DataElementValueRanges/Create
      var url = "";
      if (this.rowId == null) {
        url = "/ServiceManage/Offer/DbFieldAllValue";
      } else {
        url = "CodoRelationship/Update";
      }

      this.$post(
        url +
          "?id=" +
          this.itemObj.DName +
          "&tableName=" +
          this.itemObj.Table_name +
          "&page=" +
          this.page_card_b.page +
          "&limit=" +
          this.page_card_b.limit +
          "&fieldName=" +
          val.FieldName
      )
        .then((res) => {
          if (res.code == 0) {
            this.rowId = null;
            (this.itemList = [
              {
                oriValue: "1",
                desValue: "1",
              },
              {
                oriValue: "男",
                desValue: "1",
              },
            ]),
              // this.right_res = res.data.data
              (this.right_res = res.data);
            this.$message({
              message: "绑定成功",
              type: "success",
            });
          } else {
            this.$message({
              message: res.msg,
              type: "error",
            });
          }
        })
        .catch((err) => {});
    },
    // 获取系统名称列表
    getTName() {
      this.$get("/ServiceManage/Offer/Application?dataType=2").then((res) => {
        if (res.code == 0) {
          this.optionsTName = res.data;
        } else if (res.code == -1) {
          this.$message({
            message: res.msg,
            type: "warning",
          });
        }
      });
    },
    // 获取系统版本号列表
    getVersion(val) {
      this.optionsVersion = [];
      this.optionsDName = [];
      this.itemObj.Version = "";
      this.itemObj.DName = "";
      this.getTable_autos = [];
      this.getTable_auto_code = val;
      this.optionsVersion = val.Child;
      // this.optionsVersion.push(val.Child.Version)
      // this.optionsDName.push(val.Child.Child.DName)
    },
    getDName(val) {
      this.名称列表 = val;
      this.ApplicationName = val.ApplicationName;
      this.optionsDName = val.Child;
      // this.optionsVersion.push(val.Child.Version)
      // this.optionsDName.push(val.Child.Child.DName)
    },

    getDataList(TName, pMainCate) {
      this.isLoading_c = true;
      this.itemList = [];
      var params = this.getDataListObj;
      //GET /v1/DataElementValueRanges/tree/{RangeCode}/details
      if (TName) {
        this.$post(
          "CodoRelationship/PageList?codoCode=" +
            TName +
            "&pMainCate=" +
            pMainCate
        )
          .then((res) => {
            this.itemObj.Id = 0;
            if (res.code == 0) {
              this.itemList = res.data.list;
              this.total = res.data.TotalPage;
              this.isLoading_c = false;
            } else if (res.code == -1) {
              this.$message({
                message: res.msg,
                type: "warning",
              });
            }
          })
          .catch((err) => {});
      } else {
        this.$post("CodoRelationship/PageList")
          .then((res) => {
            this.itemObj.Id = 0;
            // this.itemObj.TName = ""
            // this.itemObj.Version = ""
            // this.itemObj.codoCode = ""
            // this.itemObj.DName = ""
            // this.getTable_autos = []
            if (res.code == 0) {
              this.itemList = res.data.list;
              this.total = res.data.TotalPage;
            } else if (res.code == -1) {
              this.$message({
                message: res.msg,
                type: "warning",
              });
            }
          })
          .catch((err) => {});
      }
      this.loading = false;
    },
    deleteData(id) {
      var params = {};
      //POST /v1/DataElementValueRanges/{id}/Delete
      var url = "CodoRelationship/Delete/" + id;

      this.$post(url, params)
        .then((res) => {
          if (res.code == 0) {
            this.getDataList(this.itemObj.CodeName);
          } else if (res.code == -1) {
            this.$message({
              message: res.msg,
              type: "warning",
            });
          }
        })
        .catch((err) => {});
    },
    // 编辑菜单
    EditList(val) {
      this.rowId = val.row.Id;
    },

    val_left_Tcode_change() {
      this.queryG();
    },
    //添加菜单
    Susscssful() {
      var params = this.Permission;
      //POST /api/Permission/Create
      this.$post("CodoRelationship/PageList", params)
        .then((res) => {
          if (res.code == 0) {
            this.queryG();
            this.Permission = {
              PermissionId: 0,
              PermissionName: "",
              ParentId: 1,
              Url: "",
            };
          } else if (res.code == -1) {
            this.$message({
              message: res.msg,
              type: "warning",
            });
          }
        })
        .catch((err) => {});
    },
    //添加子级菜单
    addjgTJ(node, data) {
      this.selectZZJGObj = data;
      this.isShow = "addJGTJ";
    },
    addJGDataTJ() {
      var params = this.PermissionTK;
      this.PermissionTK.ParentId = this.selectZZJGObj.PermissionId;
      this.$post("DataElementValueRanges/Create", params)
        .then((res) => {
          if (res.code == 0) {
            this.queryG();
            this.PermissionTK = {
              PermissionId: 0,
              PermissionName: "",
              ParentId: 0,
              Url: "",
            };
            this.isShow = "";
            this.selectZZJGObj = {};
          } else if (res.code == -1) {
            this.$message({
              message: res.msg,
              type: "warning",
            });
          }
        })
        .catch((err) => {});
    },
    deleteList(val) {
      this.$confirm("确定删除?", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then((_) => {
          let id = val.row.Id;
          this.$post("CodoRelationship/Delete/" + id).then((res) => {
            if (res.code == 0) {
              this.$message({
                message: "删除成功",
                type: "success",
              });
              this.getDataList(this.itemObj.RangeCode, this.itemObj.Category);
            } else if (res.code == -1) {
              this.$message({
                message: res.msg,
                type: "warning",
              });
            }
          });
        })
        .catch((_) => {});
    },
    searchLeft() {
      this.$refs.tree.filter(this.value_Left);
    },
    filterNode(value, data, node) {
      let parentNode = node.parent; // 父级node
      let labels = [node.label]; // 当前node的名字
      let level = 1; // 层级
      while (level < node.level) {
        labels = [...labels, parentNode.label]; // 当前node名字，父级node的名字
        parentNode = parentNode.parent;
        level++;
      }
      return labels.some((d) => d.indexOf(value) !== -1);
    },
    searchRight() {
      this.$post(
        "CodoRelationship/PageList?thirdMain=" +
          this.value_Right +
          "&codoCode=" +
          this.itemObj.RangeCode +
          "&pMainCate=" +
          this.itemObj.Category
      ).then((res) => {
        if (res.code == 0) {
          this.itemList = res.data.list;
        } else if (res.code == -1) {
          this.$message({
            message: res.msg,
            type: "warning",
          });
        }
      });
    },
    //删除菜单
    remove(node, data) {
      this.selectZZJGObj = data;
      // const parent = node.parent;
      // const children = parent.data.powers || parent.data;
      // const index = children.findIndex(d => d.id === data.id);
      this.$confirm("删除此菜单, 是否继续?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          var params = {
            Id: this.selectZZJGObj.PermissionId,
          };
          this.$post("DataElementValueRanges/Delete", params)
            .then((res) => {
              if (res.code == 0) {
                this.queryG();
              } else if (res.code == -1) {
                this.$message({
                  message: res.msg,
                  type: "warning",
                });
              }
            })
            .catch((err) => {});
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消删除",
          });
        });
    },
    getReset() {
      this.Permission = {
        PermissionId: 0,
        PermissionName: "",
        ParentId: 0,
        Url: "",
      };
    },
    getdata(KeyCode) {
      if (!KeyCode) {
        var data = {
          code: "get_sys_dict2",
          input: {
            code: KeyCode,
          },
        };
        this.$post("CloudHIS/getRedisDataByCode", data)
          .then((res) => {
            res.data.forEach((v) => {
              if (v.keycode == "Permission_categories") {
                this.model_select_label = v.dtl;
              } else {
                this.model_pop_up = v.dtl;
              }
            });
          })
          .catch((err) => {});
      } else {
        return false;
      }
    },
    // 自动对照按钮逻辑
    Automatic_comparison() {
      var tab = this.right_res.list.relations;
      var tree = this.Automatic_tree;
      for (var i in tab) {
        for (var j in tree) {
          if (tab[i].oriValue == tree[j].Code) {
            tab[i].desValue = tree[j].Code;
          }
        }
      }
      this.right_res.list.relations = tab;
      this.$message({
              message: "对照完成！",
              type: "success",
            });
    },
    Automatic_ok() {
      this.$post("/ServiceManage/Offer/SaveRangeControl", this.right_res.list).then(
        (res) => {
            if (res.code == 0) {
            this.$message({
              message: "操作成功！",
              type: "success",
            });
          } else {
            this.$message({
              message: res.msg,
              type: "error",
            });
          }
        }
      );
    },
  },
  created() {
    if (this.$route.query.Token) {
      localStorage.setItem("Token", this.$route.query.Token);
    }
    var a = [
      "Permission_categories", //权限类别
      "pop_up", //弹出方式
    ];
    this.BanBenHao();
    // this.queryG();
    this.getdata(a);
    this.getTName();
  },
};
</script>
  <style lang="scss">
.LicenseInformationSJY {
  .dLeftMain {
    position: absolute;
    width: 370px;
    top: 45px;
    left: 0;
    bottom: 20px;
    border-right: 1px solid #ddd;
    overflow: auto;
    padding-top: 8px;
  }

  .cardPD {
    .text {
      font-size: 12px;
    }

    .el-card__header {
      padding: 8px 20px;
      border-bottom: 1px solid #ebeef5;
      -webkit-box-sizing: border-box;
      box-sizing: border-box;
      background-color: azure;
    }

    .item {
      margin-bottom: 18px;
    }

    .clearfix:before,
    .clearfix:after {
      display: table;
      content: "";
    }

    .clearfix:after {
      clear: both;
    }

    .box-card {
      width: 100%;
    }
  }

  .ypList {
    .el-input__inner {
      // height: 20px !important;
      padding: 0 0 0 15px !important;
    }

    .el-input__inner {
      -webkit-appearance: none;
      background-color: #fff;
      background-image: none;
      border-radius: 4px;
      border: 1px solid #dcdfe6;
      -webkit-box-sizing: border-box;
      box-sizing: border-box;
      color: #606266;
      display: inline-block;
      font-size: 10px !important;
      height: 40px;
      line-height: 40px;

      -webkit-transition: border-color 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);
      transition: border-color 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);
      width: 100%;
    }

    .el-autocomplete-suggestion li {
      padding: 0px 6px !important;
      margin: 0;
      line-height: 34px;
      cursor: pointer;
      color: #606266;
      font-size: 10px !important;
      list-style: none;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
  }

  input {
    color: #000;
  }

  .dRightMain {
    width: 960px;
    height: 855px;
    margin-left: 300px;
    padding: 20px 0 0 20px;

    p {
      clear: noth;
      height: 32px;
      margin-bottom: 10px;

      .form-control {
        width: 200px;
      }

      span {
        display: block;
        float: left;
        width: 130px;
        line-height: 32px;

        b {
          color: red;
          position: relative;
          top: 2px;
          margin-right: 10px;
          font-size: 16px;
        }
      }
    }
  }

  .column2 {
    width: 640px;

    label {
      width: 110px;
    }
  }
}
</style>
  <style>
.dd {
  display: block;
  width: 100%;
}
.box-card-is {
  display: inline-block !important;
  /* width: 33% !important; */
  width: 100%;
  height: 500px !important;
}
.el-card__header {
  text-align: center;
  font-weight: 700;
  font-size: 18px;
}
.box-card-is .el-card__body {
  height: 780px;
}
.card_one .el-card__body {
  height: 650px;
  overflow-y: auto !important;
}
.formStyle {
  display: inline-block;
  margin-right: 15px;
  margin-bottom: -20px;
}

.inputS {
  width: 200px;
}
element.style {
  margin-right: 0 !important;
}
.TwoCard {
  height: 500px;
  /* overflow-y: auto; */
}
.pageSum {
  text-align: center;
}
b {
  font-weight: 700;
  border-bottom: 1px solid #000;
}
@media screen and (max-width: 1300px) {
  .inputS {
    width: 120px !important;
  }
}
</style>
  